FROM golang:alpine AS builder

LABEL stage=gobuilder

ENV CGO_ENABLED 0
ENV GOOS linux
ENV GOPROXY https://goproxy.cn,direct

WORKDIR /build/zero

COPY . .
COPY ./conf /app/conf
COPY ./.env /app/.env
RUN go mod download
RUN go build -ldflags="-s -w" -o /app/hello .


FROM alpine
ENV TZ=Asia/Shanghai
RUN apk update --no-cache && apk add --no-cache ca-certificates tzdata
#RUN cp -a /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

WORKDIR /app
COPY --from=builder /app/hello /app/hello
COPY --from=builder /app/conf /app/conf
COPY --from=builder /app/.env /app/.env

CMD ["./hello"]
